//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Windows.Forms;
//using DevExpress.Accessibility;
//using DevExpress.XtraEditors;
//using DevExpress.XtraEditors.Controls;
//using DevExpress.XtraEditors.Drawing;
//using DevExpress.XtraEditors.Registrator;
//using DevExpress.XtraEditors.Repository;
//using DevExpress.XtraEditors.ViewInfo;
//using DevExpress.XtraGrid;
//using DevExpress.XtraGrid.Views.Base;

//namespace Comteck.Winforms.Controls {
//  /// <summary>
//  /// 
//  /// </summary>
//  [ToolboxItem(true)]
//  public class MyLookUpEdit : LookUpEdit {
//    /// <summary>
//    /// 自动注册下拉框编辑器
//    /// </summary>
//    static MyLookUpEdit() {
//      RepositoryItemMyLookUpEdit.Register();
//    }

//    /// <summary>
//    /// 创建自定义LookUpEdit
//    /// </summary>
//    public MyLookUpEdit() : base() {
//      Initialize();
//    }

//    /// <summary>
//    /// 初始化
//    /// </summary>
//    private void Initialize() {
//      this.Tag = false;   // 设置全选标记
//      this.Properties.AllowMouseWheel = false;
//      //this.EnterMoveNextControl = true;
//      this.Properties.ImmediatePopup = true;

//      this.Enter += new EventHandler(this.MyLookUpEdit_Enter);
//      this.MouseUp += new MouseEventHandler(this.MyLookUpEdit_MouseUp);
//      this.DoubleClick += new EventHandler(this.MyLookUpEdit_DoubleClick);
//      this.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
//      this.KeyDown += this.MyLookUpEdit_KeyDown;
//    }

//    /// <summary>
//    /// 
//    /// </summary>
//    /// <param name="sender"></param>
//    /// <param name="e"></param>
//    private void MyLookUpEdit_KeyDown(object sender, KeyEventArgs e) {
//    }

//    /// <summary>
//    /// 自定义编辑器名称
//    /// </summary>
//    public override string EditorTypeName => RepositoryItemMyLookUpEdit.EditorName;

//    /// <summary>
//    /// 重写下拉框编辑器
//    /// </summary>
//    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
//    public new RepositoryItemMyLookUpEdit Properties => base.Properties as RepositoryItemMyLookUpEdit;

//    //
//    // 摘要:
//    //     Gets or sets whether focus is moved to the next control (according to the tab
//    //     order) when an end-user presses ENTER.
//    [DefaultValue(true)]
//    //[DevExpressXtraEditorsLocalizedDescriptionAttribute("BaseEditEnterMoveNextControl")]
//    [DXCategory("Behavior")]
//    public override bool EnterMoveNextControl { get; set; } = true;

//    #region 编辑框默认自动全选 add by geping@2017-07-13

//    /// <summary>
//    /// 鼠标移入文本编辑框触发事件
//    /// </summary>
//    /// <param name="sender"></param>
//    /// <param name="e"></param>   
//    private void MyLookUpEdit_Enter(object sender, EventArgs e) {
//      // 设置全选标记
//      this.Tag = true;
//      this.SelectAll();
//    }

//    /// <summary>
//    /// 获取输入焦点时自动全选
//    /// </summary>
//    /// <param name="sender"></param>
//    /// <param name="e"></param>    
//    private void MyLookUpEdit_MouseUp(object sender, MouseEventArgs e) {
//      // 如果鼠标左键操作并且标记存在，则执行全选
//      if (e.Button == MouseButtons.Left && (bool)this.Tag) {
//        this.SelectAll();
//      }

//      // 取消全选标记
//      this.Tag = false;
//    }

//    /// <summary>
//    /// 双击输入框时自动全选
//    /// </summary>
//    /// <param name="sender"></param>
//    /// <param name="e"></param>
//    private void MyLookUpEdit_DoubleClick(object sender, EventArgs e) {
//      this.SelectAll();
//    }

//    #endregion

//  }

//  /// <summary>
//  /// 匹配自定义编辑器的下拉LookUpEdit
//  /// </summary>
//  [DXCategory("Properties")]
//  [UserRepositoryItem("Register")]
//  public class RepositoryItemMyLookUpEdit : RepositoryItemLookUpEdit {

//    /// <summary>
//    /// 
//    /// </summary>
//    internal const string EditorName = nameof(MyLookUpEdit);

//    /// <summary>
//    /// 
//    /// </summary>
//    public override string EditorTypeName => EditorName;

//    /// <summary>
//    /// 注册编辑器
//    /// </summary>
//    static RepositoryItemMyLookUpEdit() {
//      Register();
//    }

//    /// <summary>
//    /// 创建自定义的编辑器
//    /// </summary>
//    public RepositoryItemMyLookUpEdit() {
//    }

//    /// <summary>
//    /// 下拉框样式
//    /// </summary>
//    [DefaultValue(TextEditStyles.Standard)]
//    [DXCategory("Behavior")]
//    public override TextEditStyles TextEditStyle { get; set; } = TextEditStyles.Standard;

//    /// <summary>
//    /// 注册编辑器
//    /// </summary>
//    public static void Register() {
//      EditorRegistrationInfo.Default.Editors.Add(
//          new EditorClassInfo(
//              EditorName,
//              typeof(MyLookUpEdit),
//              typeof(RepositoryItemMyLookUpEdit),
//              typeof(LookUpEditBaseViewInfo),
//              new ButtonEditPainter(),
//              true,
//              EditImageIndexes.LookUpEdit,
//              typeof(LookupPopupAccessibleObject)));
//    }

//  }
//}
